package com.baobao.domain;

import java.io.Serializable;

import java.lang.StringBuilder;

import java.util.Calendar;

import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import javax.xml.bind.annotation.*;

import javax.persistence.*;

/**
 */
@IdClass(com.baobao.domain.AskleavePK.class)
@Entity
@NamedQueries({
		@NamedQuery(name = "findAllAskleaves", query = "select myAskleave from Askleave myAskleave"),
		@NamedQuery(name = "findAskleaveByApplyTime", query = "select myAskleave from Askleave myAskleave where myAskleave.applyTime = ?1"),
		@NamedQuery(name = "findAskleaveByApproveDetail", query = "select myAskleave from Askleave myAskleave where myAskleave.approveDetail = ?1"),
		@NamedQuery(name = "findAskleaveByApproveDetailContaining", query = "select myAskleave from Askleave myAskleave where myAskleave.approveDetail like ?1"),
		@NamedQuery(name = "findAskleaveByApproveResult", query = "select myAskleave from Askleave myAskleave where myAskleave.approveResult = ?1"),
		@NamedQuery(name = "findAskleaveByApproveResultContaining", query = "select myAskleave from Askleave myAskleave where myAskleave.approveResult like ?1"),
		@NamedQuery(name = "findAskleaveByApproveTime", query = "select myAskleave from Askleave myAskleave where myAskleave.approveTime = ?1"),
		@NamedQuery(name = "findAskleaveByDetail", query = "select myAskleave from Askleave myAskleave where myAskleave.detail = ?1"),
		@NamedQuery(name = "findAskleaveByDetailContaining", query = "select myAskleave from Askleave myAskleave where myAskleave.detail like ?1"),
		@NamedQuery(name = "findAskleaveByEndTime", query = "select myAskleave from Askleave myAskleave where myAskleave.endTime = ?1"),
		@NamedQuery(name = "findAskleaveByParentPhone", query = "select myAskleave from Askleave myAskleave where myAskleave.parentPhone = ?1"),
		@NamedQuery(name = "findAskleaveByParentPhoneContaining", query = "select myAskleave from Askleave myAskleave where myAskleave.parentPhone like ?1"),
		@NamedQuery(name = "findAskleaveByPrimaryKey", query = "select myAskleave from Askleave myAskleave where myAskleave.parentPhone = ?1 and myAskleave.studentId = ?2 and myAskleave.applyTime = ?3"),
		@NamedQuery(name = "findAskleaveByReason", query = "select myAskleave from Askleave myAskleave where myAskleave.reason = ?1"),
		@NamedQuery(name = "findAskleaveByReasonContaining", query = "select myAskleave from Askleave myAskleave where myAskleave.reason like ?1"),
		@NamedQuery(name = "findAskleaveByStartTime", query = "select myAskleave from Askleave myAskleave where myAskleave.startTime = ?1"),
		@NamedQuery(name = "findAskleaveByStatus", query = "select myAskleave from Askleave myAskleave where myAskleave.status = ?1"),
		@NamedQuery(name = "findAskleaveByStatusContaining", query = "select myAskleave from Askleave myAskleave where myAskleave.status like ?1"),
		@NamedQuery(name = "findAskleaveByStudentId", query = "select myAskleave from Askleave myAskleave where myAskleave.studentId = ?1"),
		@NamedQuery(name = "findAskleaveByStudentIdContaining", query = "select myAskleave from Askleave myAskleave where myAskleave.studentId like ?1"),
		@NamedQuery(name = "findAskleaveByTeacherPhone", query = "select myAskleave from Askleave myAskleave where myAskleave.teacherPhone = ?1"),
		@NamedQuery(name = "findAskleaveByTeacherPhoneContaining", query = "select myAskleave from Askleave myAskleave where myAskleave.teacherPhone like ?1") })
@Table(catalog = "baobaodb", name = "askleave")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "bb/com/baobao/domain", name = "Askleave")
public class Askleave implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 */

	@Column(name = "parentPhone", length = 40, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	String parentPhone;
	/**
	 */

	@Column(name = "studentId", length = 40, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	String studentId;
	/**
	 */
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "applyTime", nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	Calendar applyTime;
	/**
	 */
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "startTime", nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	Calendar startTime;
	/**
	 */
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "endTime", nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	Calendar endTime;
	/**
	 */

	@Column(name = "reason", length = 40)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String reason;
	/**
	 */

	@Column(name = "detail", length = 300)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String detail;
	/**
	 */

	@Column(name = "teacherPhone", length = 40, nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String teacherPhone;
	/**
	 */

	@Column(name = "status", length = 30)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String status;
	/**
	 */

	@Column(name = "approveResult", length = 30)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String approveResult;
	/**
	 */
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "approveTime", nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	Calendar approveTime;
	/**
	 */

	@Column(name = "approveDetail", length = 300)
	@Basic(fetch = FetchType.EAGER)
	@XmlElement
	String approveDetail;

	/**
	 */
	public void setParentPhone(String parentPhone) {
		this.parentPhone = parentPhone;
	}

	/**
	 */
	public String getParentPhone() {
		return this.parentPhone;
	}

	/**
	 */
	public void setStudentId(String studentId) {
		this.studentId = studentId;
	}

	/**
	 */
	public String getStudentId() {
		return this.studentId;
	}

	/**
	 */
	public void setApplyTime(Calendar applyTime) {
		this.applyTime = applyTime;
	}

	/**
	 */
	public Calendar getApplyTime() {
		return this.applyTime;
	}

	/**
	 */
	public void setStartTime(Calendar startTime) {
		this.startTime = startTime;
	}

	/**
	 */
	public Calendar getStartTime() {
		return this.startTime;
	}

	/**
	 */
	public void setEndTime(Calendar endTime) {
		this.endTime = endTime;
	}

	/**
	 */
	public Calendar getEndTime() {
		return this.endTime;
	}

	/**
	 */
	public void setReason(String reason) {
		this.reason = reason;
	}

	/**
	 */
	public String getReason() {
		return this.reason;
	}

	/**
	 */
	public void setDetail(String detail) {
		this.detail = detail;
	}

	/**
	 */
	public String getDetail() {
		return this.detail;
	}

	/**
	 */
	public void setTeacherPhone(String teacherPhone) {
		this.teacherPhone = teacherPhone;
	}

	/**
	 */
	public String getTeacherPhone() {
		return this.teacherPhone;
	}

	/**
	 */
	public void setStatus(String status) {
		this.status = status;
	}

	/**
	 */
	public String getStatus() {
		return this.status;
	}

	/**
	 */
	public void setApproveResult(String approveResult) {
		this.approveResult = approveResult;
	}

	/**
	 */
	public String getApproveResult() {
		return this.approveResult;
	}

	/**
	 */
	public void setApproveTime(Calendar approveTime) {
		this.approveTime = approveTime;
	}

	/**
	 */
	public Calendar getApproveTime() {
		return this.approveTime;
	}

	/**
	 */
	public void setApproveDetail(String approveDetail) {
		this.approveDetail = approveDetail;
	}

	/**
	 */
	public String getApproveDetail() {
		return this.approveDetail;
	}

	/**
	 */
	public Askleave() {
	}

	/**
	 * Copies the contents of the specified bean into this bean.
	 *
	 */
	public void copy(Askleave that) {
		setParentPhone(that.getParentPhone());
		setStudentId(that.getStudentId());
		setApplyTime(that.getApplyTime());
		setStartTime(that.getStartTime());
		setEndTime(that.getEndTime());
		setReason(that.getReason());
		setDetail(that.getDetail());
		setTeacherPhone(that.getTeacherPhone());
		setStatus(that.getStatus());
		setApproveResult(that.getApproveResult());
		setApproveTime(that.getApproveTime());
		setApproveDetail(that.getApproveDetail());
	}

	/**
	 * Returns a textual representation of a bean.
	 *
	 */
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("parentPhone=[").append(parentPhone).append("] ");
		buffer.append("studentId=[").append(studentId).append("] ");
		buffer.append("applyTime=[").append(applyTime).append("] ");
		buffer.append("startTime=[").append(startTime).append("] ");
		buffer.append("endTime=[").append(endTime).append("] ");
		buffer.append("reason=[").append(reason).append("] ");
		buffer.append("detail=[").append(detail).append("] ");
		buffer.append("teacherPhone=[").append(teacherPhone).append("] ");
		buffer.append("status=[").append(status).append("] ");
		buffer.append("approveResult=[").append(approveResult).append("] ");
		buffer.append("approveTime=[").append(approveTime).append("] ");
		buffer.append("approveDetail=[").append(approveDetail).append("] ");

		return buffer.toString();
	}

	/**
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((parentPhone == null) ? 0 : parentPhone.hashCode()));
		result = (int) (prime * result + ((studentId == null) ? 0 : studentId.hashCode()));
		result = (int) (prime * result + ((applyTime == null) ? 0 : applyTime.hashCode()));
		return result;
	}

	/**
	 */
	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof Askleave))
			return false;
		Askleave equalCheck = (Askleave) obj;
		if ((parentPhone == null && equalCheck.parentPhone != null) || (parentPhone != null && equalCheck.parentPhone == null))
			return false;
		if (parentPhone != null && !parentPhone.equals(equalCheck.parentPhone))
			return false;
		if ((studentId == null && equalCheck.studentId != null) || (studentId != null && equalCheck.studentId == null))
			return false;
		if (studentId != null && !studentId.equals(equalCheck.studentId))
			return false;
		if ((applyTime == null && equalCheck.applyTime != null) || (applyTime != null && equalCheck.applyTime == null))
			return false;
		if (applyTime != null && !applyTime.equals(equalCheck.applyTime))
			return false;
		return true;
	}
}
